<?php
namespace app\api\service;
//use \app\api\model\Address;


class UserAddress {
   
	public static function addressList() {
        
		// 版本1：简单的获取
        $model = new \app\api\model\UserAddress();
        $rs = $model; 
        return $rs;
    }
	/*
	public static function addressAdd($userId,$cont) {
        $rs = array();
		//需要对数据进行过滤
        $user_id = intval($userId);
        if ($user_id <= 0) {
            return $rs;
        }
		$data = array();
		$data['user_id'] = $user_id;
	
		$data['user_name'] = PhalApi_Tool::arrIndex($cont, "Name", "none");
		$data['user_tel'] = PhalApi_Tool::arrIndex($cont, "Tel", "none");
		$data['user_phone'] = PhalApi_Tool::arrIndex($cont, "Phone", "none");
		$data['area_id1'] = PhalApi_Tool::arrIndex($cont, "Pid", "none");
		$data['area_id2'] = PhalApi_Tool::arrIndex($cont, "Cid", "none");
		$data['area_id3'] = PhalApi_Tool::arrIndex($cont, "Qid", "none");
		$data['address'] = PhalApi_Tool::arrIndex($cont, "Addr", "none");
		$data['post_code'] = PhalApi_Tool::arrIndex($cont, "Postcode", "none");
		$data['is_default'] = PhalApi_Tool::arrIndex($cont, "Isdef", "none");
		
		
		$data['create_time'] = time();
		
		$model = new Model_Adress();
        $return = $model->addressAdd($data);
		$rs['aId'] = $return->insert_id();
		return $rs;
    }
	

	public static function addressDelete($aId) {
        $rs = array();
		$address_id = intval($aId);
        if ($address_id <= 0) {
            return $rs;
        }
		$model = new Model_Adress();
        $rs = $model->addressDelete($address_id);
        return $rs;
    }

	public static function setDefaultAddress($aId) {
		$rs = array();
		$address_id = intval($aId);
        if ($address_id <= 0) {
            return $rs;
        }
		$model = new Model_Adress();
        $rs = $model->setDefaultAddress($address_id);
        return $rs;
    }


	public static function addressInfo($aId) {
        $rs = array();
		$address_id = intval($aId);
        if ($address_id <= 0) {
            return $rs;
        }
		$model = new Model_Adress();
        $rs = $model->addressInfo($address_id);
        return $rs;
    }	
	
	public static function addressUpdate($userId,$cont) {
		/*
		address_id Id  ：地址ID
		user_name Name ：收货人名称
		user_tel Tel ： 收货人手机s
		user_phone Phone ：收货人电话
		area_id1 Pid ：地址所属省id
		area_id2 Cid ：地址所属市id
		area_id3 Qid ：地址所属区/县id
		address Addr ：详细地址
		post_code Postcode ：邮编
		is_default Isdef : 是否默认地址
		
		//需要对数据进行过滤
        $user_id = intval($userId);
        if ($user_id <= 0) {
            return $rs;
        }*//*
		//PhalApi_Tool::arrIndex($arr, "test2", "test2");数组取值
        $model = new Model_Adress();
        $rs = $model->addressUpdate($user_id,$cont);
        return $rs;
    }

*/

	
	


}
